package com.xqls.dal.dao.mybatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.xqls.dal.dao.RemotecontrolDao;
import com.xqls.dal.model.Remotecontrol;
import com.xqls.dal.model.RemotecontrolExample;
import com.xqls.dal.service.RemotecontrolMapper;

@Repository
public class RemotecontrolDaoImpl implements RemotecontrolDao{
	
	@Autowired private RemotecontrolMapper mapper;
	
	public int  insertRemote(Remotecontrol remotecontrol){
		return mapper.insertSelective(remotecontrol);
	}
	
	public int updateRemote(Remotecontrol remotecontrol){

		return mapper.updateByPrimaryKeySelective(remotecontrol);
	}
	
	public Remotecontrol queryByDeviceNo(String deviceNo){
		
		return mapper.selectBydeviceNo(deviceNo);
	}
	
	public Remotecontrol selectMaxTimeByDeviceNo(String deviceNo,String remoteType){
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("deviceNo", deviceNo);
		map.put("remoteType", remoteType);
		return mapper.selectMaxTimeByDeviceNo(map);
				
	}
	
	public  Remotecontrol selectMaxTime(String remoteType){
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("remoteType", remoteType);
		return mapper.selectMaxTime(map);
	}

}
